home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-13 | 732 b | 37 lines | [TEXT/MPS ] |
- % Logic Manager Copyright 1990 by Apple Computer, Inc.
- % Ruben Kleiman (Advanced Technology Group)
-
- % The 8 Queens program
-
- ch(1).
- ch(2).
- ch(3).
- ch(4).
- ch(5).
- ch(6).
- ch(7).
- ch(8).
-
-
- rule(queen(A,B,C,D,E,F,G,H),
- good(cons(c(1,A),cons(c(2,B),cons(c(3,C),cons(c(4,D),cons(c(5,E),
- cons(c(6,F),cons(c(7,G),cons(c(8,H),nil)))))))))).
-
- good(nil).
- rule(good(cons(X,Y)),
- and(good(Y),nocollision( X,Y ))).
-
- nocollision(X,nil).
- rule(nocollision(X,cons(First,Rest)),
- and(notoppose(X,First), nocollision(X,Rest))).
-
- rule(notoppose(c(X1,Y1),c(X2,Y2)),
- and(ch(Y1),
- and(ch(Y2),
- and(different(Y1,Y2),
- and(is(Z1,sub(Y1,Y2)),
- and(is(Z2,sub(X1,X2)),
- and(different(Z1,Z2),
- and(is(Z3,sub(X2,X1)),
- different(Z1,Z3))))))))).
-